import { AxiosPromise } from 'axios';
import request from '@/utils/request';
import { ICustomerDetail, ICustomerInfo } from './type';

export const customList = (query?: any): AxiosPromise<ICustomerInfo[]> => {
  return request({
    url: '/wiki/custom/list',
    method: 'get',
    params: query
  });
};

export const customDetail = (id: string): AxiosPromise<ICustomerDetail> => {
  return request({
    url: '/wiki/custom/' + id,
    method: 'get'
  });
};

export const saveCustom = (data: any): AxiosPromise<any> => {
  return request({
    url: '/wiki/custom',
    method: 'post',
    data
  });
};

export const updateCustom = (data: any): AxiosPromise<any> => {
  return request({
    url: '/wiki/custom',
    method: 'put',
    data
  });
};

export const queryQccInfo = (keyword: string): AxiosPromise<any> => {
  return request({
    url: '/wiki/custom/queryQccInfo/' + keyword,
    method: 'get'
  });
};

export const synCbeInfo = (zhName: string, sourceId: string): AxiosPromise<any> => {
  return request({
    url: '/wiki/custom/synCbeInfo',
    method: 'get',
    params: { zhName, sourceId }
  });
};

export const getWeChatQrCode = (id: string): AxiosPromise<any> => {
  return request({
    url: '/wiki/brand/getWeChatQrCode/' + id,
    method: 'get'
  });
};
